﻿

@Html.DevExpress().GridView(
settings =>
{
    settings.Name = "gridView";
    settings.InitDefaultPagerGridViewSettings();
    settings.EnableAlternatingRowColor();
    settings.Width = Unit.Pixel(1200);
    
    settings.SettingsPager.Visible = false;
    settings.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords;
    settings.CallbackRouteValues = new { Controller = "Account", Action = "UserGroupPartialView" };

    settings.KeyFieldName = "GROUP_CODE";
    settings.Columns.Add("GROUP_NOTE", "权限组名");
    settings.Columns.Add("NOTE", "备注");
    settings.Columns.Add("IsDefault", "是否默认组").ColumnType = MVCxGridViewColumnType.CheckBox;
    
    //settings.AddYesNoColumn("IS_DEFAULT", "是否默认组");
    settings.Columns.Add(col => {
        col.CellStyle.Paddings.Padding = 1;
        col.CellStyle.Paddings.PaddingLeft = 5;
        col.Caption = "";
        col.Width = 150;
        col.CellStyle.HorizontalAlign = HorizontalAlign.Center;

        col.SetDataItemTemplateContent(c =>
        {
            string groupId = DataBinder.Eval(c.DataItem, "GROUP_CODE").ToString();
            ViewContext.Writer.Write(
                Html.ActionLink("[编辑]", "", null, new { href = "javascript:editGroup('" + groupId + "');" }) + "&nbsp;" +
                //Html.ActionLink("[编辑权限]", "", null, new { href = "javascript:edit_permission('" + groupId + "');" }) + "&nbsp;" +
                Html.ActionLink("[编辑权限]", "UserGroupPermissions", new { id = groupId }) + "&nbsp;" +
                
                Html.ActionLink("[删除]", "GroupDelete", new { id = groupId },new { onclick = "return confirm('是否要删除此权限组?')" })
            );
        }
        );
    });
}).BindEF((s, e) => {
        e.KeyExpression = "GROUP_CODE";
        e.QueryableSource = WebcarDataProvider.DB.USER_GROUP;
    }).GetHtml()



